/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
/**
 * Autogenerated by Thrift Compiler (0.15.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.accumulo.core.compaction.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public class TExternalCompaction implements org.apache.thrift.TBase<TExternalCompaction, TExternalCompaction._Fields>, java.io.Serializable, Cloneable, Comparable<TExternalCompaction> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TExternalCompaction");

  private static final org.apache.thrift.protocol.TField QUEUE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("queueName", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField COMPACTOR_FIELD_DESC = new org.apache.thrift.protocol.TField("compactor", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField UPDATES_FIELD_DESC = new org.apache.thrift.protocol.TField("updates", org.apache.thrift.protocol.TType.MAP, (short)3);
  private static final org.apache.thrift.protocol.TField JOB_FIELD_DESC = new org.apache.thrift.protocol.TField("job", org.apache.thrift.protocol.TType.STRUCT, (short)4);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TExternalCompactionStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TExternalCompactionTupleSchemeFactory();

  public @org.apache.thrift.annotation.Nullable java.lang.String queueName; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String compactor; // required
  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.Long,TCompactionStatusUpdate> updates; // required
  public @org.apache.thrift.annotation.Nullable org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob job; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    QUEUE_NAME((short)1, "queueName"),
    COMPACTOR((short)2, "compactor"),
    UPDATES((short)3, "updates"),
    JOB((short)4, "job");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // QUEUE_NAME
          return QUEUE_NAME;
        case 2: // COMPACTOR
          return COMPACTOR;
        case 3: // UPDATES
          return UPDATES;
        case 4: // JOB
          return JOB;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.QUEUE_NAME, new org.apache.thrift.meta_data.FieldMetaData("queueName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.COMPACTOR, new org.apache.thrift.meta_data.FieldMetaData("compactor", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.UPDATES, new org.apache.thrift.meta_data.FieldMetaData("updates", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64), 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCompactionStatusUpdate.class))));
    tmpMap.put(_Fields.JOB, new org.apache.thrift.meta_data.FieldMetaData("job", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TExternalCompaction.class, metaDataMap);
  }

  public TExternalCompaction() {
  }

  public TExternalCompaction(
    java.lang.String queueName,
    java.lang.String compactor,
    java.util.Map<java.lang.Long,TCompactionStatusUpdate> updates,
    org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob job)
  {
    this();
    this.queueName = queueName;
    this.compactor = compactor;
    this.updates = updates;
    this.job = job;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TExternalCompaction(TExternalCompaction other) {
    if (other.isSetQueueName()) {
      this.queueName = other.queueName;
    }
    if (other.isSetCompactor()) {
      this.compactor = other.compactor;
    }
    if (other.isSetUpdates()) {
      java.util.Map<java.lang.Long,TCompactionStatusUpdate> __this__updates = new java.util.HashMap<java.lang.Long,TCompactionStatusUpdate>(other.updates.size());
      for (java.util.Map.Entry<java.lang.Long, TCompactionStatusUpdate> other_element : other.updates.entrySet()) {

        java.lang.Long other_element_key = other_element.getKey();
        TCompactionStatusUpdate other_element_value = other_element.getValue();

        java.lang.Long __this__updates_copy_key = other_element_key;

        TCompactionStatusUpdate __this__updates_copy_value = new TCompactionStatusUpdate(other_element_value);

        __this__updates.put(__this__updates_copy_key, __this__updates_copy_value);
      }
      this.updates = __this__updates;
    }
    if (other.isSetJob()) {
      this.job = new org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob(other.job);
    }
  }

  public TExternalCompaction deepCopy() {
    return new TExternalCompaction(this);
  }

  @Override
  public void clear() {
    this.queueName = null;
    this.compactor = null;
    this.updates = null;
    this.job = null;
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getQueueName() {
    return this.queueName;
  }

  public TExternalCompaction setQueueName(@org.apache.thrift.annotation.Nullable java.lang.String queueName) {
    this.queueName = queueName;
    return this;
  }

  public void unsetQueueName() {
    this.queueName = null;
  }

  /** Returns true if field queueName is set (has been assigned a value) and false otherwise */
  public boolean isSetQueueName() {
    return this.queueName != null;
  }

  public void setQueueNameIsSet(boolean value) {
    if (!value) {
      this.queueName = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getCompactor() {
    return this.compactor;
  }

  public TExternalCompaction setCompactor(@org.apache.thrift.annotation.Nullable java.lang.String compactor) {
    this.compactor = compactor;
    return this;
  }

  public void unsetCompactor() {
    this.compactor = null;
  }

  /** Returns true if field compactor is set (has been assigned a value) and false otherwise */
  public boolean isSetCompactor() {
    return this.compactor != null;
  }

  public void setCompactorIsSet(boolean value) {
    if (!value) {
      this.compactor = null;
    }
  }

  public int getUpdatesSize() {
    return (this.updates == null) ? 0 : this.updates.size();
  }

  public void putToUpdates(long key, TCompactionStatusUpdate val) {
    if (this.updates == null) {
      this.updates = new java.util.HashMap<java.lang.Long,TCompactionStatusUpdate>();
    }
    this.updates.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.Long,TCompactionStatusUpdate> getUpdates() {
    return this.updates;
  }

  public TExternalCompaction setUpdates(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.Long,TCompactionStatusUpdate> updates) {
    this.updates = updates;
    return this;
  }

  public void unsetUpdates() {
    this.updates = null;
  }

  /** Returns true if field updates is set (has been assigned a value) and false otherwise */
  public boolean isSetUpdates() {
    return this.updates != null;
  }

  public void setUpdatesIsSet(boolean value) {
    if (!value) {
      this.updates = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob getJob() {
    return this.job;
  }

  public TExternalCompaction setJob(@org.apache.thrift.annotation.Nullable org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob job) {
    this.job = job;
    return this;
  }

  public void unsetJob() {
    this.job = null;
  }

  /** Returns true if field job is set (has been assigned a value) and false otherwise */
  public boolean isSetJob() {
    return this.job != null;
  }

  public void setJobIsSet(boolean value) {
    if (!value) {
      this.job = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case QUEUE_NAME:
      if (value == null) {
        unsetQueueName();
      } else {
        setQueueName((java.lang.String)value);
      }
      break;

    case COMPACTOR:
      if (value == null) {
        unsetCompactor();
      } else {
        setCompactor((java.lang.String)value);
      }
      break;

    case UPDATES:
      if (value == null) {
        unsetUpdates();
      } else {
        setUpdates((java.util.Map<java.lang.Long,TCompactionStatusUpdate>)value);
      }
      break;

    case JOB:
      if (value == null) {
        unsetJob();
      } else {
        setJob((org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case QUEUE_NAME:
      return getQueueName();

    case COMPACTOR:
      return getCompactor();

    case UPDATES:
      return getUpdates();

    case JOB:
      return getJob();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case QUEUE_NAME:
      return isSetQueueName();
    case COMPACTOR:
      return isSetCompactor();
    case UPDATES:
      return isSetUpdates();
    case JOB:
      return isSetJob();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof TExternalCompaction)
      return this.equals((TExternalCompaction)that);
    return false;
  }

  public boolean equals(TExternalCompaction that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_queueName = true && this.isSetQueueName();
    boolean that_present_queueName = true && that.isSetQueueName();
    if (this_present_queueName || that_present_queueName) {
      if (!(this_present_queueName && that_present_queueName))
        return false;
      if (!this.queueName.equals(that.queueName))
        return false;
    }

    boolean this_present_compactor = true && this.isSetCompactor();
    boolean that_present_compactor = true && that.isSetCompactor();
    if (this_present_compactor || that_present_compactor) {
      if (!(this_present_compactor && that_present_compactor))
        return false;
      if (!this.compactor.equals(that.compactor))
        return false;
    }

    boolean this_present_updates = true && this.isSetUpdates();
    boolean that_present_updates = true && that.isSetUpdates();
    if (this_present_updates || that_present_updates) {
      if (!(this_present_updates && that_present_updates))
        return false;
      if (!this.updates.equals(that.updates))
        return false;
    }

    boolean this_present_job = true && this.isSetJob();
    boolean that_present_job = true && that.isSetJob();
    if (this_present_job || that_present_job) {
      if (!(this_present_job && that_present_job))
        return false;
      if (!this.job.equals(that.job))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetQueueName()) ? 131071 : 524287);
    if (isSetQueueName())
      hashCode = hashCode * 8191 + queueName.hashCode();

    hashCode = hashCode * 8191 + ((isSetCompactor()) ? 131071 : 524287);
    if (isSetCompactor())
      hashCode = hashCode * 8191 + compactor.hashCode();

    hashCode = hashCode * 8191 + ((isSetUpdates()) ? 131071 : 524287);
    if (isSetUpdates())
      hashCode = hashCode * 8191 + updates.hashCode();

    hashCode = hashCode * 8191 + ((isSetJob()) ? 131071 : 524287);
    if (isSetJob())
      hashCode = hashCode * 8191 + job.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(TExternalCompaction other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetQueueName(), other.isSetQueueName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueueName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.queueName, other.queueName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetCompactor(), other.isSetCompactor());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCompactor()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compactor, other.compactor);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetUpdates(), other.isSetUpdates());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUpdates()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updates, other.updates);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetJob(), other.isSetJob());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetJob()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.job, other.job);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TExternalCompaction(");
    boolean first = true;

    sb.append("queueName:");
    if (this.queueName == null) {
      sb.append("null");
    } else {
      sb.append(this.queueName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("compactor:");
    if (this.compactor == null) {
      sb.append("null");
    } else {
      sb.append(this.compactor);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("updates:");
    if (this.updates == null) {
      sb.append("null");
    } else {
      sb.append(this.updates);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("job:");
    if (this.job == null) {
      sb.append("null");
    } else {
      sb.append(this.job);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (job != null) {
      job.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class TExternalCompactionStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TExternalCompactionStandardScheme getScheme() {
      return new TExternalCompactionStandardScheme();
    }
  }

  private static class TExternalCompactionStandardScheme extends org.apache.thrift.scheme.StandardScheme<TExternalCompaction> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TExternalCompaction struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // QUEUE_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.queueName = iprot.readString();
              struct.setQueueNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // COMPACTOR
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.compactor = iprot.readString();
              struct.setCompactorIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // UPDATES
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
                struct.updates = new java.util.HashMap<java.lang.Long,TCompactionStatusUpdate>(2*_map0.size);
                long _key1;
                @org.apache.thrift.annotation.Nullable TCompactionStatusUpdate _val2;
                for (int _i3 = 0; _i3 < _map0.size; ++_i3)
                {
                  _key1 = iprot.readI64();
                  _val2 = new TCompactionStatusUpdate();
                  _val2.read(iprot);
                  struct.updates.put(_key1, _val2);
                }
                iprot.readMapEnd();
              }
              struct.setUpdatesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // JOB
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.job = new org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob();
              struct.job.read(iprot);
              struct.setJobIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, TExternalCompaction struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.queueName != null) {
        oprot.writeFieldBegin(QUEUE_NAME_FIELD_DESC);
        oprot.writeString(struct.queueName);
        oprot.writeFieldEnd();
      }
      if (struct.compactor != null) {
        oprot.writeFieldBegin(COMPACTOR_FIELD_DESC);
        oprot.writeString(struct.compactor);
        oprot.writeFieldEnd();
      }
      if (struct.updates != null) {
        oprot.writeFieldBegin(UPDATES_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.STRUCT, struct.updates.size()));
          for (java.util.Map.Entry<java.lang.Long, TCompactionStatusUpdate> _iter4 : struct.updates.entrySet())
          {
            oprot.writeI64(_iter4.getKey());
            _iter4.getValue().write(oprot);
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.job != null) {
        oprot.writeFieldBegin(JOB_FIELD_DESC);
        struct.job.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TExternalCompactionTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TExternalCompactionTupleScheme getScheme() {
      return new TExternalCompactionTupleScheme();
    }
  }

  private static class TExternalCompactionTupleScheme extends org.apache.thrift.scheme.TupleScheme<TExternalCompaction> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TExternalCompaction struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetQueueName()) {
        optionals.set(0);
      }
      if (struct.isSetCompactor()) {
        optionals.set(1);
      }
      if (struct.isSetUpdates()) {
        optionals.set(2);
      }
      if (struct.isSetJob()) {
        optionals.set(3);
      }
      oprot.writeBitSet(optionals, 4);
      if (struct.isSetQueueName()) {
        oprot.writeString(struct.queueName);
      }
      if (struct.isSetCompactor()) {
        oprot.writeString(struct.compactor);
      }
      if (struct.isSetUpdates()) {
        {
          oprot.writeI32(struct.updates.size());
          for (java.util.Map.Entry<java.lang.Long, TCompactionStatusUpdate> _iter5 : struct.updates.entrySet())
          {
            oprot.writeI64(_iter5.getKey());
            _iter5.getValue().write(oprot);
          }
        }
      }
      if (struct.isSetJob()) {
        struct.job.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TExternalCompaction struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(4);
      if (incoming.get(0)) {
        struct.queueName = iprot.readString();
        struct.setQueueNameIsSet(true);
      }
      if (incoming.get(1)) {
        struct.compactor = iprot.readString();
        struct.setCompactorIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TMap _map6 = iprot.readMapBegin(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.STRUCT); 
          struct.updates = new java.util.HashMap<java.lang.Long,TCompactionStatusUpdate>(2*_map6.size);
          long _key7;
          @org.apache.thrift.annotation.Nullable TCompactionStatusUpdate _val8;
          for (int _i9 = 0; _i9 < _map6.size; ++_i9)
          {
            _key7 = iprot.readI64();
            _val8 = new TCompactionStatusUpdate();
            _val8.read(iprot);
            struct.updates.put(_key7, _val8);
          }
        }
        struct.setUpdatesIsSet(true);
      }
      if (incoming.get(3)) {
        struct.job = new org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob();
        struct.job.read(iprot);
        struct.setJobIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
  private static void unusedMethod() {}
}

